<?php use_helper('I18N', 'Date') ?>
<?php include_partial('ins_abonnement/assets') ?>

<div id="sf_admin_container" class="sf_admin_edit ui-widget ui-widget-content ui-corner-all">
    <div class="fg-toolbar ui-widget-header ui-corner-all">
        <h1><?php echo __('Modification d\'une inscription', array(), 'messages') ?></h1>
    </div>

    <?php include_partial('ins_abonnement/flashes') ?>

    <div id="sf_admin_header">
        <?php include_partial('ins_abonnement/form_header', array('ins_abonnement' => $ins_abonnement, 'form' => $form, 'configuration' => $configuration)) ?>
    </div>


    <!-- ici on passe au partial le formulaire de choix des dates le formulaire correspondant -->
    <div id="sf_admin_content">
        <?php if($form->getObject()->isNew()) { ?>
            <?php include_partial('ins_abonnement/form', array('ins_abonnement' => $ins_abonnement, 'form' => $form, 'configuration' => $configuration, 'helper' => $helper)) ?>
        <?php }else{ ?>
            <?php include_partial('ins_abonnement/form', array('ins_abonnement' => $ins_abonnement, 'form' => $form, 'dates_form' => $dates_form, 'configuration' => $configuration, 'helper' => $helper)) ?>
        <?php } ?>
    </div>

    <div id="sf_admin_footer">
        <?php include_partial('ins_abonnement/form_footer', array('ins_abonnement' => $ins_abonnement, 'form' => $form, 'configuration' => $configuration)) ?>
    </div>

    <?php include_partial('ins_abonnement/themeswitcher') ?>
</div>


<!-- AJOUT : "dialog" qui affiche un formulaire de choix des dates -->
<?php if(!$form->getObject()->isNew()) { ?>
<script type="text/javascript">
    $(function() {
        $("#dialog").dialog({
            bgiframe: true,
            autoOpen: false,
            modal: true,
            width: 400
        });

    });
</script>
<div id="dialog" title="Représentations retenues">
    <form action="<?php echo url_for('ins_abonnement/creerReservations?id_contact='. $form->getObject()->getIdContact() .'&id_groupe='. $form->getObject()->getIdGroupe() .'&id_inscription='. $form->getObject()->getId()) ?>" method="post">
        <table>
            <tfoot>
                <tr>
                    <td colspan="2">
                        <?php echo $dates_form->renderHiddenFields(false) ?>
                        <input type="submit" value="Valider" />
                    </td>
                </tr>
            </tfoot>
            <tbody>
                <?php echo $dates_form->renderGlobalErrors() ?>
                <?php echo $dates_form ?>
            </tbody>
        </table>
    </form>
</div>
<?php } ?>